package learnjava.basic.other;

import java.util.HashMap;

public class TestHash {
    public static void main(String[] args) {
        System.out.println(isEqual(1232334564,8));
    }

    public static boolean isEqual(int h, int n){
        int len = 1<<n;
        int res = h%len;  //h%(2^n)
        int and = h&(len-1); //h&(2^n-1)
        return res==and;
    }
}
